<?php
/**
 * Copyright (c) [2019] [吴跃忠]
 * [selibra] is licensed under the Mulan PSL v1.
 * You can use this software according to the terms and conditions of the Mulan PSL v1.
 * You may obtain a copy of Mulan PSL v1 at:
 * http://license.coscl.org.cn/MulanPSL
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
 * PURPOSE.
 * See the Mulan PSL v1 for more details.
 */
namespace Selibra\WebSocket\Interceptor;


class ActionSpaceNode
{

    /**
     * @var array
     */
    public array $childNode;


    /**
     * @var ActionSpaceTree
     */
    public ActionSpaceTree $tree;


    protected string $nodeName;


    /**
     * @var string
     */
    protected string $namespace;


    /**
     * @var string
     */
    protected string $method;


    /**
     * ActionSpaceNode constructor.
     * @param string $nodeName
     */
    public function __construct(string $nodeName)
    {
        $this->nodeName = $nodeName;
    }


    /**
     * @return ActionSpaceTree
     */
    public function getTree()
    {
        if (!isset($this->tree)) {
            $this->tree = new ActionSpaceTree();
        }
        return $this->tree;
    }

    /**
     * @param ActionSpaceTree $tree
     */
    public function setTree(ActionSpaceTree $tree): void
    {
        $this->tree = $tree;
    }

    /**
     * @return string
     */
    public function getNodeName(): string
    {
        return $this->nodeName;
    }

    /**
     * @return string
     */
    public function getNamespace(): string
    {
        return $this->namespace;
    }

    /**
     * @param string $namespace
     */
    public function setNamespace(string $namespace): void
    {
        $this->namespace = $namespace;
    }

    /**
     * @return string
     */
    public function getMethod(): string
    {
        return $this->method;
    }

    /**
     * @param string $method
     */
    public function setMethod(string $method): void
    {
        $this->method = $method;
    }

    /**
     * @param string $nodeName
     */
    public function setNodeName(string $nodeName): void
    {
        $this->nodeName = $nodeName;
    }

}